package com.handong.handserialprogram.widget.component;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.handong.handserialprogram.R;
import com.handong.handserialprogram.utils.SystemUtil;
import com.handong.handserialprogram.widget.guideview.Component;

/**
 * Created by binIoter on 16/6/17.
 */
public class MutiComponent implements Component {

    private int mReason;

    public MutiComponent(int resId) {
        mReason = resId;
    }

    @Override
    public View getView(LayoutInflater inflater) {
        LinearLayout ll = new LinearLayout(inflater.getContext());
        LinearLayout.LayoutParams param =
                new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                        LinearLayout.LayoutParams.WRAP_CONTENT);
        ll.setOrientation(LinearLayout.VERTICAL);
        ll.setLayoutParams(param);
        TextView textView = new TextView(inflater.getContext());
        //textView.setText(R.string.nearby);
        textView.setText(mReason);
        textView.setTextColor(inflater.getContext().getResources().getColor(R.color.text_white));
        textView.setPadding(20, 0, 20, 0);
        textView.setTextSize(Math.round(SystemUtil.displayMetricsDpi(inflater.getContext()) * 12));
        ImageView imageView = new ImageView(inflater.getContext());
        imageView.setImageResource(R.drawable.guide_view_arrow);
        ll.removeAllViews();
        ll.addView(imageView);
        ll.addView(textView);
        return ll;
    }

    @Override
    public int getAnchor() {
        return Component.ANCHOR_BOTTOM;
    }

    @Override
    public int getFitPosition() {
        return Component.FIT_CENTER;
    }

    @Override
    public int getXOffset() {
        return 0;
    }

    @Override
    public int getYOffset() {
        return 20;
    }
}
